<template>
    <div class="textInfo">
        <h4>{{newsInfo.title}}</h4>
        <p class="newsTitle">
            <span>发表时间:{{newsInfo.add_time|daterFormat}}</span>
            <span>点击:{{newsInfo.click}}次</span>
        </p>
        <hr>
        <div class="content" v-html = "newsInfo.content"></div>
        <comment-box :id="$route.params.id"></comment-box>
    </div>
</template>


<script>
import {Toast} from 'mint-ui'
import comment from "../../subcomponents/comment.vue"
    export default {
        data(){
            return {
                newsInfo:{}
            }
        },
        created(){
           this.getnewsInfo()
        },
        methods:{
            getnewsInfo(){
                var id = this.$route.params.id;
             this.$http.get("api/getnew/"+id).then(result=>{
                    if(result.body.status===0){
                       this.newsInfo =  result.body.message[0]
                    }else{
                        Toast("获取内容失败")
                    }
                })
            }
        },
        components:{
            "comment-box":comment
        }
    }
</script>


<style lang="">
.newsTitle{
    font-size: 14px;
    margin-top: 0;
    margin-bottom: 10px;
    color: #8f8f94;
    color: #26A2FF;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
}
.content{
    color:gray ;
}
.content img{
    width:100%;
}
.textInfo{
    padding:0 6px;
}
</style>